package com.sui.bigdata.rtcadmin.testEnv;

import com.feidee.fdcommon.model.StringResponse;
import com.feidee.fdcommon.util.HttpUtil;
import org.apache.http.Consts;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;

/**
 * @author YongChen
 * @date 2019/12/25 10:24
 * @description
 * @email yong_chen@sui.com
 */
public class stop {

    public static void main(String[] args) throws Exception {


//        String url =  "http://adam.feidee.com/rtc-admin/job?action=stop";
        String url = "http://10.201.7.132:18001/rtc-admin/job?token=b5a0df95aba940019d64f02d64e8ed27&action=stop";
//        String url = "http://localhost:18001/rtc-admin/job?action=submit";

        String data = "{\"jobName\":\"ssj_transaction_ADS-798\"}";
        System.out.println(data);
        StringEntity stringEntity = new StringEntity(data, Consts.UTF_8);
        stringEntity.setContentEncoding("UTF-8");
        stringEntity.setContentType("application/json");

        HttpPost httpPost=new HttpPost(url);

        RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(500000).build();
        httpPost.setEntity(stringEntity);
        httpPost.setConfig(requestConfig);
        StringResponse response = HttpUtil.post(httpPost);
        System.out.println(">>>>> "+response.getResponseBody());
    }
}
